package com.example.wangkai.wangkai.app;

import android.app.Application;
import android.content.SharedPreferences;

import org.xutils.x;

/**
 * Created by Administrator on 2016/11/9.
 */
public class MyApplication extends Application {
    public static MyApplication context;
    public static String token;
//    private String  phone;

    @Override
    public void onCreate() {
        super.onCreate();
        x.Ext.init(this);
        context=this;

    }

    public static MyApplication getContext(){
        return context;
    }

//    public void saveCurrentPhone(String phone){
//        this.phone =phone;
//    }
//
//    public String getCurrentPhone(){
//        return this.phone;
//    }



    public void saveToken(String token){
        this.token = token;
        SharedPreferences pref = getSharedPreferences("token", MODE_PRIVATE);
        SharedPreferences.Editor editor = pref.edit();
        editor.putString("token",token);
        editor.commit();
    }

    public String getToken(){
        SharedPreferences pref = getSharedPreferences("token", MODE_PRIVATE);
        String token=pref.getString("token","");
        return token;
    }


}
